package ninja9.muzik.dao;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user", catalog = "muzik")
public class User implements java.io.Serializable {

	// Fields

	private Integer id;
	private String email;
	private String password;
	private String firstname;
	private String lastname;
	private Boolean active;
	private Set<FavoriteAlbum> favoriteAlbums = new HashSet<FavoriteAlbum>(0);
	private Set<Playlist> playlists = new HashSet<Playlist>(0);
	private Set<FavoriteSinger> favoriteSingers = new HashSet<FavoriteSinger>(0);
	private Set<FavoriteSong> favoriteSongs = new HashSet<FavoriteSong>(0);

	// Constructors

	/** default constructor */
	public User() {
	}

	/** minimal constructor */
	public User(String email, String password, String firstname,
			String lastname, Boolean active) {
		this.email = email;
		this.password = password;
		this.firstname = firstname;
		this.lastname = lastname;
		this.active = active;
	}

	/** full constructor */
	public User(String email, String password, String firstname,
			String lastname, Boolean active, Set<FavoriteAlbum> favoriteAlbums,
			Set<Playlist> playlists, Set<FavoriteSinger> favoriteSingers,
			Set<FavoriteSong> favoriteSongs) {
		this.email = email;
		this.password = password;
		this.firstname = firstname;
		this.lastname = lastname;
		this.active = active;
		this.favoriteAlbums = favoriteAlbums;
		this.playlists = playlists;
		this.favoriteSingers = favoriteSingers;
		this.favoriteSongs = favoriteSongs;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "email", nullable = false, length = 65535)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "password", nullable = false, length = 65535)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "firstname", nullable = false, length = 65535)
	public String getFirstname() {
		return this.firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	@Column(name = "lastname", nullable = false, length = 65535)
	public String getLastname() {
		return this.lastname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	@Column(name = "active", nullable = false)
	public Boolean getActive() {
		return this.active;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<FavoriteAlbum> getFavoriteAlbums() {
		return this.favoriteAlbums;
	}

	public void setFavoriteAlbums(Set<FavoriteAlbum> favoriteAlbums) {
		this.favoriteAlbums = favoriteAlbums;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Playlist> getPlaylists() {
		return this.playlists;
	}

	public void setPlaylists(Set<Playlist> playlists) {
		this.playlists = playlists;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<FavoriteSinger> getFavoriteSingers() {
		return this.favoriteSingers;
	}

	public void setFavoriteSingers(Set<FavoriteSinger> favoriteSingers) {
		this.favoriteSingers = favoriteSingers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<FavoriteSong> getFavoriteSongs() {
		return this.favoriteSongs;
	}

	public void setFavoriteSongs(Set<FavoriteSong> favoriteSongs) {
		this.favoriteSongs = favoriteSongs;
	}

}